import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

/* 一级菜单component Layout */
import Layout from '@/layout'

/* 二级菜单component sencondMenu */
const sencondMenu = {
  render: h => h('keep-alive', {}, [h('router-view')])
}

/**
 * Note: sub-menu only appear when route children.length >= 1
 * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
 *
 * hidden: true                   if set true, item will not show in the sidebar(default is false)
 * alwaysShow: true               if set true, will always show the root menu
 *                                if not set alwaysShow, when item has more than one children route,
 *                                it will becomes nested mode, otherwise not show the root menu
 * redirect: noRedirect           if set noRedirect will no redirect in the breadcrumb
 * name:'router-name'             the name is used by <keep-alive> (must set!!!)
 * meta : {
    roles: ['admin','editor']    control the page roles (you can set multiple roles)
    title: 'title'               the name show in sidebar and breadcrumb (recommend set)
    icon: 'svg-name'             the icon show in the sidebar
    breadcrumb: false            if set false, the item will hidden in breadcrumb(default is true)
    activeMenu: '/example/list'  if set path, the sidebar will highlight the path you set
  }
 */

const constantRoutesComponents = {
  login: () => import('@/views/login/index'),
  app_jyz: () => import('@/views/app/worker/app_view_jyz'),
  app_zhsc: () => import('@/views/app/worker/app_view_zhsc'),
  app_znh: () => import('@/views/app/worker/app_view_znh'),
  _404: () => import('@/views/404'),
  no_token_portal: () => import('@/views/no_token_portal'),
  // app工人-查看工单
  app_worker_view_workorder: () => import('@/views/app/worker/app_view_workorder'),
  // app工人-查看工单楼盘详情
  app_view_workorder_building: () => import('@/views/app/worker/app_view_workorder_building'),
  //app工人-查看工单详情
  app_view_workorder_detail: () => import('@/views/app/worker/app_view_workorder_detail'),
  //app工人-查看楼盘
  app_worker_view_building: () => import('@/views/app/worker/app_view_building'),
  //app工人-查看楼盘设备详情
  app_view_building_device: () => import('@/views/app/worker/app_view_building_device'),
  //app工人-查看楼盘设备替换
  app_view_building_device_choose: () => import('@/views/app/worker/app_view_building_device_choose'),
  //app-查看拍照要求
  app_photo_requirement: () => import('@/views/system/app/photo_requirement'),
  //app-1个查看拍照要求
  app_photo_requirement_one: () => import('@/views/system/app/photo_requirement_one'),
  // app下载安装包
  app_download: () => import('@/views/system/app/download_page'),
  // 客户确认单
  customer_check: () => import('@/views/business/market_order/customer_check'),
  // 供应商确认单
  supplier_check: () => import('@/views/business/ad_make_order/supplier_check')
}

export const asyncRoutesComponents = {

  // 首页
  index: Layout,

  // 工作台
  work_platform: Layout,
  // 工作台
  work_platform_index: () => import('@/views/work_platform/index'),

  // 个人中心
  personal: Layout,
  // 工作计划
  personal_plan: () => import('@/views/personal/plan/index'),
  // 工作总结
  personal_sum: () => import('@/views/personal/sum/index'),
  // 日程安排
  personal_schedule: () => import('@/views/personal/schedule/index'),
  // 成长轨迹
  personal_grow: () => import('@/views/personal/grow/index'),
  // 待办提醒
  personal_handler: sencondMenu,
  // 待审核
  personal_handler_to_check: () => import('@/views/personal/handle/to_check'),
  // 流程中
  personal_handler_processing: () => import('@/views/personal/handle/processing'),
  // 已通过
  personal_handler_finished: () => import('@/views/personal/handle/finished'),
  // 被退回
  personal_handler_back: () => import('@/views/personal/handle/back'),
  // 草稿箱
  personal_handler_draft: () => import('@/views/personal/handle/draft'),
  // 已删除
  personal_handler_delete: () => import('@/views/personal/handle/delete'),
  // 审核记录
  personal_handler_checked: () => import('@/views/personal/handle/checked'),
  // 我的任务
  personal_mission: sencondMenu,
  // 发起任务
  personal_mission_my_send: () => import('@/views/personal/mission/my_send'),
  // 待办任务
  personal_mission_my_receive: () => import('@/views/personal/mission/my_receive'),
  // 处理-客户报备
  personal_handler_customer_reporting: () => import('@/views/business/customer/info/index'),
  // 处理-请假
  personal_handler_leave_apply: () => import('@/views/personnel/attendance/leave_apply_info'),
  // 处理-加班
  personal_handler_overtime_apply: () => import('@/views/personnel/attendance/overtime_apply_info'),
  // 处理-报价
  offer_check_or_edit: () => import('@/views/business/offer/check'),
  //处理-客户修改
  personal_handler_customer_edit: () => import('@/views/business/customer/info/index'),
  //处理-考察登记
  personal_handler_entry_apply: () => import('@/views/personnel/on_turn/entry_apply'),
  //处理-入编申请
  personal_handler_probation_assess: () => import('@/views/personnel/on_turn/probation_assess'),
  //处理-调岗申请
  personal_handler_trans_position: () => import('@/views/personnel/on_turn/trans_position'),
  //处理-离职申请
  personal_handler_leave_office: () => import('@/views/personnel/on_turn/leave_office'),
  // 处理-用章申请
  personal_handler_use_seal_apply: () => import('@/views/administration/seal/seal_apply_details'),
  // 处理-印章借用
  personal_handler_borrow_seal_apply: () => import('@/views/administration/seal/seal_out_bring_details'),
  // 处理-普通报销
  personal_handler_reimbursement_apply: () => import('@/views/administration/expense/reimbursement_info'),
  // 处理-付款申请
  personal_handler_payment_apply: () => import('@/views/administration/expense/expense_adv_charge_info'),
  // 处理核销
  personal_handler_write_off_apply: () => import('@/views/administration/expense/expense_adv_charge_info'),
  // 处理合同审批-加载页
  personal_handler_contract_apply: () => import('@/views/business/contract/loading'),
  // 真正处理合同审批页
  personal_handler_contract_apply_check: () => import('@/views/business/contract/detail'),
  // 真正处理补充合同审批页
  personal_handler_contract_apply_update: () => import('@/views/business/contract/update'),
  // 处理销售单审批
  // personal_handler_sale_order_apply: () => import('@/views/business/sale_order/detail'),
  personal_handler_sale_order_apply: () => import('@/views/new/sale_order/detail'),
  // 市场单审批
  // personal_handler_market_order_apply: () => import('@/views/business/market_order/detail'),
  personal_handler_market_order_apply: () => import('@/views/new/market_order/detail'),
  // 制作单审批
  personal_handler_ad_make_order_apply: () => import('@/views/business/ad_make_order/detail'),
  // 处理开票申请
  personal_handler_invoice_apply: () => import('@/views/business/invoice/sale_apply_invoice_detail'),
  // 处理销售单撤销
  personal_handler_sale_order_cancel: () => import('@/views/new/sale_order/detail_cancel'),
  // 处理市场单撤销
  personal_handler_market_order_cancel: () => import('@/views/new/market_order/detail'),
  // 业务管理
  business: Layout,
  // 市场管理
  market_manage: sencondMenu,
  // 项目管理
  building_area_list: () => import('@/views/business/building/list'),
  // 项目详情
  building_area_detail: () => import('@/views/business/building/detail'),
  // 项目地图
  building_area_map: () => import('@/views/business/building/map'),
  // 调度销售单列表
  sale_order: () => import('@/views/business/sale_order/market_sale_order'),
  // 上画明细表
  worker_submit_record: () => import ('@/views/business/worker_submit_count/record'),
  // 工人工作量统计表
  worker_submit_count: () => import('@/views/business/worker_submit_count/page'),
  // 市场人员查看销售单
  market_manage_check_list: () => import('@/views/business/market_order/market_order_check_list'),
  // 市场人员检查销售单
  market_manage_look: () => import('@/views/business/market_order/merket_check'),
  // 销售管理
  sales: sencondMenu,
  // 业务进度-全公司客户
  business_flow: () => import('@/views/business/business_flow/customer_list'),
  // 业务进度-我的客户
  business_flow_my: () => import('@/views/business/business_flow/customer_list_my'),
  // 报价设置
  offer_manage: () => import('@/views/business/offer/index'),
  // 报价查询
  offer_query: () => import('@/views/business/offer/query'),
  // 报价修改
  offer_update: () => import('@/views/business/offer/update'),
  // 我的客户
  my_customer: () => import('@/views/business/customer/list/MyCustomer'),
  // 报备客户界面
  customer_reporting: () => import('@/views/business/customer/info/index'),
  // 修改客户信息页
  customer_edit_page: () => import('@/views/business/customer/info/index'),
  // 部门客户池
  customer_manage: () => import('@/views/business/customer/list/index'),
  // 公海
  international_waters: () => import('@/views/business/customer/international_waters/index'),
  // 客户池
  customer_pool: () => import('@/views/business/customer/pool/index'),
  // 客户查看信息页
  look_customer_page: () => import('@/views/business/customer/info/index'),
  // 我的客户界面查看客户信息页
  my_customer_look_page: () => import('@/views/business/customer/info/index'),
  // 部门客户查看客户信息
  customer_manage_look_page: () => import('@/views/business/customer/info/index'),
  // 我的合同
  contract_my: () => import('@/views/business/contract/my'),
  // 合同列表
  contract_list: () => import('@/views/business/contract/list'),
  // 合同详情页
  contract_detail: () => import('@/views/business/contract/detail'),
  // 查看合同详情
  look_contract_detail: () => import('@/views/business/contract/detail'),
  // 添加补充协议
  supplementary_agreement_add_page: () => import('@/views/business/contract/update'),
  // 我的合同——查看补充协议
  supplementary_agreement_look_page: () => import('@/views/business/contract/update'),
  // 合同列表——查看补充协议
  list_supplementary_agreement_look_page: () => import('@/views/business/contract/update'),
  // 我的销售单
  // sale_order_my: () => import('@/views/business/sale_order/my'),
  sale_order_my: () => import('@/views/new/sale_order/my'),
  // 销售单列表
  // sale_order_list: () => import('@/views/business/sale_order/list'),
  sale_order_list: () => import('@/views/new/sale_order/list'),
  // 新建销售单详情页
  // create_sale_order_detail: () => import('@/views/business/sale_order/detail'),
  create_sale_order_detail: () => import('@/views/new/sale_order/detail'),
  // 查看销售单详情页
  // sale_order_detail: () => import('@/views/business/sale_order/detail'),
  sale_order_detail: () => import('@/views/business/sale_order/detail'),
  //import('@/views/new/sale_order/detail'),
  // 查看我的销售单
  // my_sale_order: () => import('@/views/business/sale_order/detail'),
  my_sale_order: () => import('@/views/business/sale_order/detail'),
  //import('@/views/new/sale_order/detail'),
  // 市场执行单
  // market_order: () => import('@/views/business/market_order/list'),
  market_order: () => import('@/views/new/market_order/list'),
  // 拍照要求
  shoot_requirement: () => import('@/views/new/shoot_requirement/list'),
  // 客户报备等级
  customer_level: () => import('@/views/new/customer_level/list'),
  // 创建市场执行单
  // create_market_order: () => import('@/views/business/market_order/detail'),
  create_market_order: () => import('@/views/new/market_order/detail'),
  // 查看市场单详情
  // look_market_order_detail: () => import('@/views/business/market_order/detail'),
  look_market_order_detail: () => import('@/views/business/market_order/detail'),
  // 广告制作单
  ad_make_order: () => import('@/views/business/ad_make_order/list'),
  // 新建广告制作单
  create_ad_make_order_detail: () => import('@/views/business/ad_make_order/add'),
  // 查看广告制作单
  look_ad_make_order_detail: () => import('@/views/business/ad_make_order/detail'),
  // 安装工单
  install_order: () => import('@/views/business/install_order/list'),
  // 安装工单新增页
  install_order_add_page: () => import('@/views/business/install_order/edit'),
  // 安装工单编辑页
  install_order_edit_page: () => import('@/views/business/install_order/edit'),
  // 监播列表
  detect_list: () => import('@/views/business/detect/list'),
  // 业务统计
  bus_statis: () => import('@/views/business/bus_statis/index'),
  // 上画率
  painting_rate: () => import('@/views/business/bus_statis/painting_rate'),
  // 选位方案
  purpose_plan: () => import('@/views/new/work_platform/point_plan'),
  // 选位方案编辑页
  point_plan_detail: () => import('@/views/new/work_platform/point_plan_detail'),
  // 点位信息
  point_count: () => import('@/views/business/point_count/index'),
  // 安装统计
  install_statistics: () => import('@/views/business/install_statistics/index'),
  // 销售申请开票列表
  sale_apply_invoice: () => import('@/views/business/invoice/sale_apply_invoice'),
  // 添加发票申请页面
  create_invoice_apply: () => import('@/views/business/invoice/sale_apply_invoice_detail'),
  // 查看发票
  invoice_apply_detail: () => import('@/views/business/invoice/sale_apply_invoice_detail'),
  // 设计管理
  designManage: sencondMenu,
  // 设计人员查看的市场单列表
  design_market_order_list: () => import('@/views/business/market_order/design_list'),
  // 设计人员查案市场单详情
  design_market_order_detail: () => import('@/views/new/market_order/detail'),
  // 销售经理拆分任务
  semi_annual_plan: () => import('@/views/business/annual_plan/annual_plan_list'),
  // 拆分任务编辑页
  semi_annual_plan_edit: () => import('@/views/business/annual_plan/annual_plan'),
  // 销售填写任务
  half_year_target: () => import('@/views/business/annual_plan/half_year_target'),
  // 月份任务
  month_target: () => import('@/views/business/annual_plan/month_target'),
  // 公司月度目标
  company_month_target: () => import('@/views/business/annual_plan/company_month_target'),
  // 公司年度目标
  company_year_target: () => import('@/views/business/annual_plan/company_year_target'),
  // 销售年度目标展示
  half_year_target_show: () => import('@/views/business/annual_plan/half_year_target_show'),
  // 销售年度目标管理
  half_year_target_manage: () => import('@/views/business/annual_plan/half_year_target_show'),
  // 人事管理
  personnel_admin: Layout,
  // 组织架构
  org: sencondMenu,
  // 花名册
  roster: () => import('@/views/personnel/org/roster'),
  // 花名册详情
  details_page: () => import('@/views/personnel/org/roster/roster_details'),
  // 花名册-入编申请
  probation_assess_for_roster: () => import('@/views/personnel/on_turn/probation_assess'),
  // 花名册-调岗申请
  trans_position_for_roster: () => import('@/views/personnel/on_turn/trans_position'),
  // 部门设置
  department: () => import('@/views/personnel/org/department/index'),
  // 角色设置
  role: () => import('@/views/personnel/org/role/index'),
  // 入离调转
  personnel_on_turn: sencondMenu,
  // 考察管理
  entry_apply_list: () => import('@/views/personnel/on_turn/entry_apply_list'),
  // 考察登记
  entry_apply: () => import('@/views/personnel/on_turn/entry_apply'),
  // 入编管理
  probation_assess_list: () => import('@/views/personnel/on_turn/probation_assess_list'),
  // 入编申请
  probation_assess: () => import('@/views/personnel/on_turn/probation_assess'),
  // 调岗管理
  trans_position_list: () => import('@/views/personnel/on_turn/trans_position_list'),
  // 调岗申请
  trans_position: () => import('@/views/personnel/on_turn/trans_position'),
  // 离职管理
  leave_office_list: () => import('@/views/personnel/on_turn/leave_office_list'),
  // 离职申请
  leave_office: () => import('@/views/personnel/on_turn/leave_office'),
  // 我的离职
  leave_office_list_my: () => import('@/views/personnel/on_turn/leave_office_list_my'),
  // 员工培训
  train: sencondMenu,
  // 培训计划
  train_plan: () => import('@/views/personnel/train/train_plan'),
  // 培训签到
  train_sign_in: () => import('@/views/personnel/train/train_sign_in'),
  // 培训考核
  train_check: () => import('@/views/personnel/train/train_check'),
  // 知识库
  train_knowledge_base: () => import('@/views/personnel/train/train_knowledge_base'),
  // 考勤管理
  attendance: sencondMenu,
  // 签到打卡
  clock_in: () => import('@/views/personnel/attendance/clock_in'),
  // 请假申请
  leave_apply: () => import('@/views/personnel/attendance/leave_apply'),
  // 请假申请填写
  leave_apply_info: () => import('@/views/personnel/attendance/leave_apply_info'),
  // 加班申请
  overtime_apply: () => import('@/views/personnel/attendance/overtime_apply'),
  // 加班申请填写
  overtime_apply_info: () => import('@/views/personnel/attendance/overtime_apply_info'),
  // 员工考核
  staff_check: sencondMenu,
  // 考勤汇总
  staff_check_attend_sum: () => import('@/views/personnel/staff_check/staff_check_attend_sum'),
  // 工单绩效
  staff_check_order_performance: () => import('@/views/personnel/staff_check/staff_check_order_performance'),
  // 薪资管理
  salary: sencondMenu,
  // 薪资设置
  salary_set: () => import('@/views/personnel/salary/salary_set'),
  // 薪资核算
  salary_account: () => import('@/views/personnel/salary/salary_account'),
  // 统计报表
  statis_chart: sencondMenu,
  // 统计报表
  statis_chart_index: () => import('@/views/personnel/statis_chart/index'),

  // 行政管理
  administration: Layout,
  // 报销管理
  expense: sencondMenu,
  // 普通报销
  expense_general: () => import('@/views/administration/expense/expense_general'),
  // 我的报销
  my_expense_general: () => import('@/views/administration/expense/expense_general'),
  // 报销申请页
  reimbursement_info: () => import('@/views/administration/expense/reimbursement_info'),
  // 差旅报销
  expense_travel: () => import('@/views/administration/expense/expense_travel'),
  // 预付款
  expense_adv_charge: () => import('@/views/administration/expense/expense_adv_charge'),
  // 我的付款
  my_expense_adv_charge: () => import('@/views/administration/expense/expense_adv_charge'),
  // 预付款申请页
  expense_adv_charge_info: () => import('@/views/administration/expense/expense_adv_charge_info'),
  // 核销审批
  write_off: () => import('@/views/administration/expense/expense_adv_charge_info'),
  // 我的暂支
  // my_temporary_bill: () => import('@/views/administration/expense/temporary_bill'),
  // 暂支管理
  // temporary_bill_manage: () => import('@/views/administration/expense/temporary_bill'),
  // // 暂支申请页
  // temporary_bill_info: () => import('@/views/administration/expense/temporary_bill_info'),
  // 物品管理
  goods: sencondMenu,
  // 入库管理
  goods_in: () => import('@/views/administration/goods/goods_in'),
  // 出库管理
  goods_out: () => import('@/views/administration/goods/goods_out'),
  // 出库申请页
  goods_out_info: () => import('@/views/administration/goods/goods_out_info'),
  // 库存管理
  goods_storage: () => import('@/views/administration/goods/goods_storage'),
  // 报废管理
  goods_scrap: () => import('@/views/administration/goods/goods_scrap'),
  // 印章管理
  seal: sencondMenu,
  // 印章申请
  seal_apply: () => import('@/views/administration/seal/seal_apply'),
  // 印章外带
  seal_out_bring: () => import('@/views/administration/seal/seal_out_bring'),
  // 我的用印申请
  my_seal_apply: () => import('@/views/administration/seal/seal_apply'),
  // 我的印章外带申请
  my_seal_out_bring: () => import('@/views/administration/seal/seal_out_bring'),
  // 用印申请详情页
  seal_apply_details: () => import('@/views/administration/seal/seal_apply_details'),
  // 外借印章详情页
  borrow_seal_apply_details: () => import('@/views/administration/seal/seal_out_bring_details'),
  // 公司动态
  dynamic: sencondMenu,
  // 公司动态
  dynamic_index: () => import('@/views/administration/dynamic/dynamic_index'),

  // 财务管理
  finance: Layout,
  // 供应商管理
  supplier: sencondMenu,
  // 供应商列表
  supplier_list: () => import('@/views/finance/supplier/supplier_list'),
  // 设备采购
  supplier_device_buy: () => import('@/views/finance/supplier/supplier_device_buy'),
  // 物料采购
  supplier_material_buy: () => import('@/views/finance/supplier/supplier_material_buy'),
  // 平台管理
  platform: sencondMenu,
  // 平台类型
  platform_type: () => import('@/views/finance/platform/platform_type'),
  // 平台合同
  platform_contract: () => import('@/views/finance/platform/platform_contract'),
  // 合同管理
  contract_manage: sencondMenu,
  // 采购合同
  contract_manage_buy: () => import('@/views/finance/contract_manage/new_contract_manage.vue'),
  // 销售合同
  contract_manage_sale: () => import('@/views/finance/contract_manage/contract_manage_sale'),
  // 账款管理
  account: sencondMenu,
  // 已到款
  account_received: () => import('@/views/finance/account/account_received'),
  // 已付款
  account_paid: () => import('@/views/finance/account/account_paid'),
  // 应收款
  account_receivable: () => import('@/views/finance/account/account_receivable'),
  // 发票管理
  invoice: sencondMenu,
  // 待开票
  invoice_to_be: () => import('@/views/finance/invoice/invoice_to_be'),
  // 财务查看发票详情
  finance_invoice_apply_detail: () => import('@/views/business/invoice/sale_apply_invoice_detail'),
  // 已开票
  invoice_has: () => import('@/views/finance/invoice/invoice_has'),
  // 统计分析
  finance_statis_analy: sencondMenu,
  // 成本分析
  finance_statis_analy_cost: () => import('@/views/finance/finance_statis_analy/finance_statis_analy_cost'),
  // 利润分析
  finance_statis_analy_profit: () => import('@/views/finance/finance_statis_analy/finance_statis_analy_profit'),
  // 人均产值
  finance_statis_analy_value_per_man: () => import('@/views/finance/finance_statis_analy/finance_statis_analy_value_per_man'),

  // 系统
  system: Layout,
  // 门户编号管理
  manage_code: () => import('@/views/system/manage_code/index'),
  // 配置项
  setting_item: () => import('@/views/system/setting_item/index'),
  // 数据字典
  dict: () => import('@/views/system/dict/index'),
  // 审核流程
  flow: () => import('@/views/system/flow/index'),
  // 示例审核流程业务
  test_flow: () => import('@/views/system/test_flow/index'),
  // 用户
  user: () => import('@/views/system/user/index'),
  // 媒体类型
  media_type: () => import('@/views/system/media/media_type'),
  // 媒体类型分类
  media_type_classification: () => import('@/views/system/media/media_type_classification'),
  // 规格管理
  specs_manage: () => import('@/views/system/media/specs_manage'),

  // 市场管理
  develop_manage: sencondMenu,
  // 我的销售单
  sale_order_my_new: () => import('@/views/new/sale_order/my'),
  // 销售单列表
  sale_order_list_new: () => import('@/views/new/sale_order/list'),
  // 新建销售单详情页
  create_sale_order_detail_new: () => import('@/views/new/sale_order/detail'),
  // 查看销售单详情页
  sale_order_detail_new: () => import('@/views/new/sale_order/detail'),
  // 查看我的销售单
  my_sale_order_new: () => import('@/views/new/sale_order/detail'),
  // 市场执行单
  market_order_new: () => import('@/views/new/market_order/list'),
  // 创建市场执行单
  create_market_order_new: () => import('@/views/new/market_order/detail'),
  // 查看市场单详情
  look_market_order_detail_new: () => import('@/views/new/market_order/detail'),
  // 处理销售单审批
  personal_handler_sale_order_apply_new: () => import('@/views/new/sale_order/detail'),
  // 市场单审批
  personal_handler_market_order_apply_new: () => import('@/views/new/market_order/detail')

}

/**
 * constantRoutes
 * a base page that does not have permission requirements
 * all roles can be accessed
 */
export const constantRoutes = [{
  path: '/login',
  component: constantRoutesComponents.login,
  hidden: true
},
  {
    path: '/404',
    component: constantRoutesComponents._404,
    hidden: true
  },
  {
    path: '/app/worker/view_workorder',
    component: constantRoutesComponents.app_worker_view_workorder,
    hidden: true
  },
  {
    path: '/app/view/workorder_building',
    component: constantRoutesComponents.app_view_workorder_building,
    hidden: true
  },
  {
    path: '/app/view/workorder_detail',
    component: constantRoutesComponents.app_view_workorder_detail,
    hidden: true
  },
  {
    path: '/app/worker/view_building',
    component: constantRoutesComponents.app_worker_view_building,
    hidden: true
  },
  {
    path: '/app/view/app_view_building_device',
    component: constantRoutesComponents.app_view_building_device,
    hidden: true
  },
  {
    path: '/app/view/app_view_building_device_choose',
    component: constantRoutesComponents.app_view_building_device_choose,
    hidden: true
  },
  {
    path: '/app/app_download',
    component: constantRoutesComponents.app_download,
    hidden: true
  },
  {
    path: '/app/worker/photo_requirement',
    component: constantRoutesComponents.app_photo_requirement,
    hidden: true
  },
  {
    path: '/app/worker/photo_requirement_one',
    component: constantRoutesComponents.app_photo_requirement_one,
    hidden: true
  },
  {
    path: '/no_token_portal',
    component: constantRoutesComponents.no_token_portal,
    hidden: true
  },
  {
    path: '/customer_check',
    component: constantRoutesComponents.customer_check,
    hidden: true
  },
  {
    path: '/supplier_check',
    component: constantRoutesComponents.supplier_check,
    hidden: true
  },
  {
    path: '/app_jyz',
    component: constantRoutesComponents.app_jyz,
    hidden: true
  }

  // other base route
  // 404 page must be placed at the end !!!

]

const createRouter = () => new VueRouter({
  // mode: 'history', // require service support
  scrollBehavior: () => ({
    y: 0
  }),
  routes: constantRoutes
})

const router = createRouter()

// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher // reset router
}

export default router
